<?php
	header("Content-type:text/html;charset=utf-8");
	$id = $_POST["user"];
	$pwd = $_POST["pwd"];
	// 连接数据库
	$conn = mysql_connect("localhost","root","root");
	
	mysql_select_db("2012");
	// $result = mysql_query("insert into Xiaomi values('$id','$pwd')",$conn);
	$num = mysql_query(" select * from Xiaomi where userId = '$id'");
		if(mysql_num_rows($num) == 0){
			echo "0";
			$result = mysql_query("insert into Xiaomi values('$id','$pwd')",$conn);
		}else{
			echo "1";
			
		}
		
		
		mysql_close($conn);
	?>
